package com.highspeed.bdk.controller.search;

import com.bianmaba.spring.data.jpa.domain.Result;
import com.bianmaba.spring.mvc.method.support.annotations.JSON;
import com.highspeed.bdk.bean.entity.physical.Board;
import com.highspeed.bdk.service.physical.IBoardService;
import com.highspeed.bdk.service.search.SearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @program: bdk-view
 * @description:
 * @author: Chenjiabin
 * @create: 2018-04-22 20:29
 **/

@RestController
@RequestMapping(value = {"search"}, method = RequestMethod.POST)
@Api(tags = "全局查询")
public class SearchController {
    @Autowired
    private SearchService service;

    @ApiOperation(value = "全局查询，模糊匹配主板或CPU的名称和编号，返回名称、类型、编号")
    @JSON
    @RequestMapping(value = "/query", method = RequestMethod.POST)
    public List<Map> query(@ApiParam(name = "value") @RequestParam String value) {
        return service.search(value);
    }
}
